/*
 * @Author: your name
 * @Date: 2021-08-02 10:38:13
 * @LastEditTime: 2021-11-18 09:21:12
 * @LastEditors: your name
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \request\demo\index.js
 */
import {
	Http
} from "../src/module/Http";
const http = new Http()
console.log('-----------', http)

http.setRunType('xhr')
// http.interceptors.request.use((res) => {
//     res.headers["token"] = 123213;
//     return res;
// });
http.interceptors.response.use((res) => {
	console.log("相应", res);
	let respone = res.data;
	return respone;
}, (err) => {
	console.log('-----------err----------')
	return err
});
window.onload = function () {
	console.log(document.getElementById('btn'))
	const inpt = document.getElementById('inpt')
	const btn = document.getElementById('btn')
	if (btn) {
		btn.addEventListener('click', function () {
			http.get('/api/get', {
					id: '2833992259634716677'
				}, {
					headers: {
						test: '123'
					}
				})
				.then((res) => {
					console.log(res);
				}).catch(err => {
					console.log('catch-------', err)
				})
		})
	}

}